import store from '@/store'
import router from '@/router'

// 导航守卫
router.beforeEach((to,from,next)=>{
  let authList=['/user/profile','/user/history']
  if(authList.includes(to.path)){
    if(store.state.user){
      next()
    }else{
      // 未登录，跳转到登录页
      next('/login?url='+to.path)
    }
  }else{
    next()
  }
})